package com.duanjw.springboot.es.web;

import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.duanjw.springboot.es.pojo.entity.Job;
import com.duanjw.springboot.es.service.impl.JobService;

import lombok.AllArgsConstructor;

@RequestMapping("job")
@RestController
@AllArgsConstructor
public class JobController {

    private final JobService jobService;

    @PostMapping
    public String saveJob(@RequestBody Job job) {
        return jobService.saveJob(job);
    }
    @GetMapping("{id}")
    public Job findById(@PathVariable String id) {
        return jobService.findById(id);
    }
    @GetMapping
    public List<Job> searchJob(@RequestParam Integer pageNumber, @RequestParam Integer pageSize, @RequestParam String searchContent) {
        return jobService.searchJob(pageNumber, pageSize, searchContent);
    }
    @GetMapping("list")
    public Iterable<Job> list(){
        return jobService.listJob();
    }
}
